package org.dentalcard.ui.api.tools;

import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import java.awt.*;

/**
 * @user: Vladimir Chernishov
 * @date: 25.12.11
 * @time: 17:56
 */
public class ComponentTableRenderer implements TableCellRenderer {

    private JLabel label = new JLabel();
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        if(value != null && value instanceof Component){
            return (Component) value;
        } else {
            label.setText(String.valueOf(value));
            return label;
        }
    }
}
